//package com.hpt.newconsumer.kt
//
//import android.util.Base64
//import com.blankj.utilcode.util.EncryptUtils
//
//
//fun ByteArray.toHexString(): String {
//    var stringBuffer = StringBuffer()
//    this.forEach {
//        val s = Integer.toHexString(it.toInt() and 0xFF)
//        if (s.length == 1) {
//            stringBuffer.append("0$s ")
//        } else {
//            stringBuffer.append("$s ")
//        }
//    }
//    return stringBuffer.toString()
//}
//
////到指定长度
//fun ByteArray.toHexString(len: Int): String {
//    var stringBuffer = StringBuffer()
//    this.forEachIndexed { index, it ->
//        if (index < len) {
//            val s = Integer.toHexString(it.toInt() and 0xFF)
//            if (s.length == 1) {
//                stringBuffer.append("0$s ")
//            } else {
//                stringBuffer.append("$s ")
//            }
//        }
//    }
//    return stringBuffer.toString()
//}
//
////转base64
//fun ByteArray.toBase64(): String {
//    return Base64.encodeToString(this, Base64.NO_WRAP)
//}
//
////get md5 后的数据 16进制字符
//fun ByteArray.getMD5(): String {
//    return EncryptUtils.encryptMD5ToString(this)
//}
//
////把一个long的整数转成相反的端口模式
//fun Long.contraryModel(): Long {
//    val bytes = byteArrayOf(
//        (this shr 0 and 0xFF).toByte(),
//        (this shr 8 and 0xFF).toByte(),
//        (this shr 16 and 0xFF).toByte(),
//        (this shr 24 and 0xFF).toByte()
//    )
//    var value: Long = 0
//    for (i in 0..3) {
//        val shift = (3 - i) * 8
//        value += (bytes[i].toInt() and 0xFF).toLong() shl shift
//    }
////    return String.format("%010d", value)
//    return value
//}
////把一个long的整数转成相反的端口模式
////fun Long.contraryModel(): Long {
////    val bytes = byteArrayOf(
////        (this shr 0 and 0xFF).toByte(),
////        (this shr 8 and 0xFF).toByte(),
////        (this shr 16 and 0xFF).toByte(),
////        (this shr 24 and 0xFF).toByte()
////    )
////    var value: Long = 0
////    for (i in 0..3) {
////        val shift = (3 - i) * 8
////        value += (bytes[i].toInt() and 0xFF).toLong() shl shift
////    }
////    return value
////}